import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:spendbook/common/constants.dart';
import 'package:spendbook/models/user.dart';

class QrCodeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final _user = context.read<User>();

    return Scaffold(
      appBar: AppBar(
        title: Text('我的二维码'),
      ),
      backgroundColor: Colors.white,
      body: Center(
        child: QrImageView(padding: EdgeInsets.all(40.0), data: encodeQrCode(_user.id.toString()), version: QrVersions.auto),
      ),
    );
  }
}
